Documentation

Overview:          
This project demonstrates the use of interfaces, enums and class implementation in Java to calculate time based values.

Features:
• In Java the code defines an interface DayCalculator with methods to get the total hours in a day and compute the remaining hours based on the current time.
• On the front end, the same logic is re-imagined as an Interactive interface where users can input days to calculate total hours — effectively mirroring the backend logic visually.

Key Takeaway:
• Learned how to define and implement interfaces in Java.
• Inheritance and polymorphism let child classes customize behaviour. 
        

Deliverable 5: Enums and SuperClasses

💻 Backend (Java Code)

        import java.util.Scanner;

interface DayCalculator {
    int getTotalHours();
    int getRemainingHours(int hoursPassed);
}

class DayHours implements DayCalculator {
    private int hoursInADay = 24;

    @Override
    public int getTotalHours()
    {
        return hoursInADay;
    }

    @Override
    public int getRemainingHours(int hoursPassed)
    {
        return  hoursInADay - hoursPassed;
    }


}

public class Calculate_Hours_In_A_Day {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        DayHours day = new DayHours();

        System.out.println("Total hours in a day: "+ day.getTotalHours());

        System.out.println("What is the current time (using a 24hr format): ");
        int hoursPassed = sc.nextInt();

        System.out.println("Hours remaining in a day: "+ day.getRemainingHours(hoursPassed));


    }
}
      

🌐 Live Frontend Demo